//
//  MLAScanResultStatusVC.m
//  MagicLampApp
//
//  Created by Zheng on 2019/4/23.
//  Copyright © 2019 zheng.magic.lamp.app. All rights reserved.
//

#import "MLAScanResultStatusVC.h"

@interface MLAScanResultStatusVC ()

@end

@implementation MLAScanResultStatusVC

- (void)backAction {
    if (self.navigationController.viewControllers.count > 1) {
        [self.navigationController popToViewController:self.navigationController.viewControllers[1] animated:YES];
    } else {
        [self.navigationController popViewControllerAnimated:YES];
    }
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self configTitle:@"支付状态"];
    
    UIImageView *statusImgv = [[UIImageView alloc] init];
    [self.view addSubview:statusImgv];
    [statusImgv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.titleView.mas_bottom).offset(40);
        make.centerX.offset(0);
        make.width.height.offset(44);
    }];
    
    UILabel *titleLbl = [[UILabel alloc] init];
    titleLbl.font = CX_GetNormalFont(14);
    titleLbl.numberOfLines = 0;
    [self.view addSubview:titleLbl];
    [titleLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.offset(0);
        make.top.equalTo(statusImgv.mas_bottom).offset(18);
    }];
    
    UIButton *leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    leftBtn.titleLabel.font = CX_GetNormalFont(14);
    leftBtn.layer.cornerRadius = 5;
    leftBtn.layer.masksToBounds = YES;
    leftBtn.layer.borderWidth = 1;
    [leftBtn addTarget:self action:@selector(leftBtnAction) forControlEvents:UIControlEventTouchUpInside];
    [leftBtn setTitle:@"确定" forState:UIControlStateNormal];
    [self.view addSubview:leftBtn];
    [leftBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.view.mas_centerX).offset(-20);
        make.top.equalTo(titleLbl.mas_bottom).offset(38);
        make.width.offset(100);
        make.height.offset(40);
    }];
    
    
    if (_isSuccess) {
        statusImgv.image = [UIImage imageNamed:@"f_sssss"];
        titleLbl.text = @"收款成功";
        titleLbl.textColor = CX_GetColorHex(0x3588EB, 1);
        [leftBtn setTitleColor:CX_GetColorBlue() forState:UIControlStateNormal];
        leftBtn.layer.borderColor = CX_GetColorBlue().CGColor;

    } else {
        statusImgv.image = [UIImage imageNamed:@"f_fffff"];
        titleLbl.text = @"您扫码的二维码错误，请从新扫码\n本系统只识别(微信)、(支付宝)，请确认后重试";
        titleLbl.textColor = CX_GetColorHex(0xF45D3F, 1);
        [leftBtn setTitleColor:CX_GetColorHex(0xF45D3F, 1) forState:UIControlStateNormal];
        leftBtn.layer.borderColor = CX_GetColorHex(0xF45D3F, 1).CGColor;
        
    }
    
    
}


- (void)leftBtnAction {
    [self.navigationController popToRootViewControllerAnimated:YES];
}



@end
